Skip to content

Improve code coverage with unit and integration tests#32

Merged
Malcolmnixon merged 4 commits intomainfrom
copilot/improve-code-coverage-tests
Jan 21, 2026
Merged

Improve code coverage with unit and integration tests#32
Malcolmnixon merged 4 commits intomainfrom
copilot/improve-code-coverage-tests

Conversation

Copy link
Contributor

Copilot AI commented Jan 21, 2026

Code coverage was at 54.88%. Added 26 tests (12 unit tests + 14 integration tests) targeting uncovered paths in core classes.

Coverage Improvements

  • Overall: 54.88% → 59.11%
  • Context: 96.21% → 100%
  • SonarHotSpot: 85.71% → 100%
  • SonarIssue: 87.5% → 100%
  • Program: 40.47% → 58.33%

Changes

  • New test files:

    • SonarHotSpotTests.cs - Record property validation and null handling
    • SonarIssueTests.cs - Record property validation across all severity levels
    • Runner.cs - Helper class for running SonarMark through dotnet for integration testing
    • IntegrationTests.cs - 14 integration tests exercising the full application via command-line
  • Enhanced existing tests:

    • ProgramTests.cs - Error handling for missing required parameters (--server, --project-key)
    • ContextTests.cs - Invalid log file path exception handling

Integration Tests

The integration tests exercise the complete application by running it through dotnet exec, covering:

  • Version, help, and validate flags
  • Missing and invalid parameter error handling
  • Silent flag behavior
  • All command-line parameter acceptance (token, branch, enforce, report, report-depth)

All tests follow existing MSTest v4 conventions with ClassName_MethodUnderTest_Scenario_ExpectedBehavior naming.

Original prompt

This section details on the original issue you should resolve

<issue_title>[Feature]: Improve Code Coverage</issue_title>
<issue_description>### Problem Statement

Code Coverage statistics need to be improved.

Proposed Solution

Add more tests to bring the code-coverage numbers up.

Alternatives Considered

No response

Additional Context

No response

Priority

Medium - Would improve workflow

Contribution

  • I would be willing to submit a PR for this feature

Code of Conduct

  • I agree to follow this project's Code of Conduct</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
@Malcolmnixon
Copy link
Contributor

@copilot The coverage numbers are still quite low. Consider enhancing the test project with:

Copilot AI changed the title [WIP] Add tests to improve code coverage Improve code coverage with targeted unit tests Jan 21, 2026
Copilot AI requested a review from Malcolmnixon January 21, 2026 16:15
Copilot AI and others added 2 commits January 21, 2026 16:20
Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 21, 2026

@copilot The coverage numbers are still quite low. Consider enhancing the test project with:

Added Runner class and 14 integration tests following the VHDLTest pattern. Code coverage improved from 54.88% to 59.11%. All 72 tests pass. Changes in commit 4329472.

Copilot AI changed the title Improve code coverage with targeted unit tests Improve code coverage with unit and integration tests Jan 21, 2026
@Malcolmnixon Malcolmnixon marked this pull request as ready for review January 21, 2026 16:45
@Malcolmnixon Malcolmnixon merged commit eae7e37 into main Jan 21, 2026
9 checks passed
@Malcolmnixon Malcolmnixon deleted the copilot/improve-code-coverage-tests branch January 21, 2026 16:45
Copilot AI added a commit that referenced this pull request Feb 20, 2026
Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Malcolmnixon added a commit that referenced this pull request Feb 20, 2026
* Initial plan

* Apply TemplateDotNetTool consistency improvements

- Add end_of_line=lf to .editorconfig for consistent line endings
- Add MD025 rule to .markdownlint-cli2.jsonc and remove inline comments
- Convert README badges to reference-style links matching template pattern
- Add comprehensive XML documentation to Context.cs ArgumentParser class
- Improve catch block documentation with expected exception types
- Reorganize test project .csproj with section comments for clarity
- Clean up workflow YAML comments to match template style

All changes maintain functionality while improving consistency with
the TemplateDotNetTool template standards.

* Fix requirements test coverage linkage

- Updated platform requirements (PLT-001 through PLT-005) to use correct test source patterns matching CI workflow naming
  - Changed from generic prefixes (windows@, ubuntu@, dotnet8.x@) to actual CI file patterns (windows-latest@, integration-test-*-dotnet*.x@)
  - Ensures requirements can be satisfied when full CI pipeline runs
- Enhanced VAL-003 and VAL-004 test coverage by adding self-validation tests
  - These tests exercise both TRX and JUnit format support through the validation functionality
  - Provides comprehensive validation of format support requirements
- All 24 locally-testable requirements are now satisfied
- 5 platform-specific requirements (PLT-*) correctly remain unsatisfied locally (requires CI matrix)
- Verified with 'dotnet reqstream --enforce'

* fix: Exclude node_modules from yamllint checks

The yamllint configuration was linting node_modules directory, causing
false positives from third-party dependencies. This change adds an
ignore section to exclude node_modules and .git directories from
yamllint checks, focusing on project files only.

* docs: Fix documentation formatting and add missing scope section

Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>

* Enhance XML documentation and literate programming style

Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>

* Improve test naming and fix cspell dictionary

Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>

* docs: Restructure user guide heading hierarchy for PDF compilation

Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>

* fix: Update requirements.yaml header comment and revert test source filter changes

Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>

* Synchronize with TemplateDotNetTool template PRs #29, #31, #32, #35

Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Improve Code Coverage

2 participants